package com.groot.common.web.pager;


public class SystemContext {
	
private static ThreadLocal<Integer> offset = new ThreadLocal<Integer>() ;				//分页的起始页
	
	private static ThreadLocal<Integer> pageSize = new ThreadLocal<Integer>() ;			//分页的大小
	
	private static ThreadLocal<String> sort = new ThreadLocal<String>() ;				//列表的排序字段
	
	private static ThreadLocal<String> order = new ThreadLocal<String>() ;				//列表的排序方式
	
	public static Integer getOffset() {
		if(null == offset.get()) {
			offset.set(1) ;
		} 
		return offset.get();
	}

	public static void setOffset(Integer _offset) {
		offset.set(_offset) ;
	}

	public static Integer getPageSize() {
		if(null == pageSize.get()) {
			pageSize.set(30) ;
		} 
		return pageSize.get();
	}

	public static void setPageSize(Integer _pagesize) {
		pageSize.set(_pagesize) ;
	}

	public static void removeOffset(){
		offset.remove();
	}
	public static void removePagesize(){
		pageSize.remove();
	}
	
	public static String getSort() {
		return sort.get();
	}

	public static void setSort(String _sort) {
		sort.set(_sort) ;
	}

	public static String getOrder() {
		return order.get();
	}

	public static void setOrder(String _order) {
		order.set(_order) ;
	}
	
	public static void removeSort() {
		sort.remove() ; 
	}
	
	public static void removeOrder() {
		order.remove() ; 
	}
	
}
